package com.wicket.okrapp.base.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wicket.okrapp.base.service.MOmsTargetAttributionCycleService;
import com.wicket.okrapp.base.service.dto.req.*;
import com.wicket.okrapp.common.dto.FieldInfo;
import com.wicket.okrapp.common.exception.BizException;
import com.wicket.okrapp.common.util.CommonFunctionHelper;
import com.wicket.okrapp.dal.mapper.mbg.OmsTargetAttributionCycleMapper;
import com.wicket.okrapp.dal.po.mbg.OmsTargetAttributionCycle;

import java.util.*;
import java.util.ArrayList;
//import com.wicket.okrapp.base.service.dto.res.*;

import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author ：
 * @since 2022/1/19 15:39
 *
 *
 * @version 1.0
 */
@Service
public class MOmsTargetAttributionCycleServiceImpl
  extends ServiceImpl<OmsTargetAttributionCycleMapper, OmsTargetAttributionCycle>
  implements MOmsTargetAttributionCycleService {

  @Autowired
  OmsTargetAttributionCycleMapper omsTargetAttributionCycleMapper;
/**
   * 3-3-09-07新增目标归属周期[8577]
   * gen by moon at 3/13/2024, 5:00:58 AM
   */
 @Trace(operationName = "3-3-09-07新增目标归属周期")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  String  addTargetBelongCycle(OmsTargetAttributionCycle omsTargetAttributionCycle) {
     omsTargetAttributionCycle.setTargetAttributionCycleId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
omsTargetAttributionCycle.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
omsTargetAttributionCycle.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
omsTargetAttributionCycle.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
omsTargetAttributionCycle.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
omsTargetAttributionCycle.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
omsTargetAttributionCycle.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
     if(super.save(omsTargetAttributionCycle)){
        return omsTargetAttributionCycle.getTargetAttributionCycleId();
     }else {
        return "-1";
     }
    
  }
/**
   * 3-3-09-07修改目标归属周期[8578]
   * gen by moon at 3/13/2024, 5:00:59 AM
   */
 @Trace(operationName = "3-3-09-07修改目标归属周期")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  boolean  updateTargetBelongCycle(OmsTargetAttributionCycle omsTargetAttributionCycle) {
     omsTargetAttributionCycle.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
omsTargetAttributionCycle.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        return super.updateById(omsTargetAttributionCycle);
  }
/**
   * 3-3-09-07查询目标归属周期详情By大于等于开始时间与小于结束时间[8579]
   * gen by moon at 5/15/2024, 11:09:26 PM
   */
 @Trace(operationName = "3-3-09-07查询目标归属周期详情By大于等于开始时间与小于结束时间")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  OmsTargetAttributionCycle  queryTargetBelongCycleDetail(QueryTargetBelongCycleDetailReq reqDto) {
     
        try {
         
            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();

            // TODO: 2024/5/13
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.ge("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.lt("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsTargetAttributionCycle> retList = super.list(queryWrapper);
            if(retList!=null && retList.size()>0){
                OmsTargetAttributionCycle retData = retList.get(0);
                
                return retData;
            }
            return null;
      } catch (Exception e) {
          e.printStackTrace();
          throw new BizException("-1",e,false);
      }
  }
/**
   * 3-3-09-07查询目标归属周期列表[8580]
   * gen by moon at 3/13/2024, 5:01:06 AM
   */
 @Trace(operationName = "3-3-09-07查询目标归属周期列表")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsTargetAttributionCycle>  queryTargetBelongCycleList(QueryTargetBelongCycleListReq reqDto) {
     
        try {
            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();

            // TODO: 2024/5/13
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.ge("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetAttributionCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            
            return ((List<OmsTargetAttributionCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-07批量删目标归属周期[8583]
   * gen by moon at 3/13/2024, 5:01:09 AM
   */
 @Trace(operationName = "3-3-09-07批量删目标归属周期")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  boolean  batchDeleteTargetBelongCycle(List<String> reqDto) {
     
          if(reqDto==null || reqDto.size()==0){
            return false;
          }
          
          return super.removeByIds(reqDto);
  }
/**
   * 3-3-09-07查询目标归属周期（双排序）列表[8627]
   * gen by moon at 3/15/2024, 3:38:05 AM
   */
 @Trace(operationName = "3-3-09-07查询目标归属周期（双排序）列表")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsTargetAttributionCycle>  queryTargetBelongCycleBySortList(QueryTargetBelongCycleBySortListReq reqDto) {

        try {
            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();


            // TODO: 2024/5/13
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.le("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.ge("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }

            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetAttributionCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            queryWrapper.orderByDesc("order_number");
queryWrapper.orderByDesc(CommonFunctionHelper.buildSpecOderBy("eva_obj_target_cycle_code"));
queryWrapper.orderByDesc("operate_time");
            return ((List<OmsTargetAttributionCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-07批量改目标归属周期[9445]
   * gen by moon at 4/26/2024, 10:05:59 AM
   */
 @Trace(operationName = "3-3-09-07批量改目标归属周期")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  boolean  batchUpdateTargetBelongCycle(List<OmsTargetAttributionCycle> omsTargetAttributionCycle) {

      if(omsTargetAttributionCycle==null || omsTargetAttributionCycle.size()==0){
        return false;
      }
        return super.saveOrUpdateBatch(omsTargetAttributionCycle);

  }
/**
   * 3-3-09-07查询目标内容目标归属周期列表[9446]
   * gen by moon at 4/26/2024, 10:06:02 AM
   */
 @Trace(operationName = "3-3-09-07查询目标内容目标归属周期列表")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsTargetAttributionCycle>  queryTargetContentBelongCycleList(QueryTargetContentBelongCycleListReq reqDto) {

        try {
            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();


            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetAttributionCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsTargetAttributionCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-07查询目标归属周期列表by大于等于开始时间且小于等于结束时间[8580]
   * gen by moon at 5/14/2024, 10:09:21 PM
   */
 @Trace(operationName = "3-3-09-07查询目标归属周期列表by大于等于开始时间且小于等于结束时间")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsTargetAttributionCycle>  queryTargetBelongCycleByTimeRangeList(QueryTargetBelongCycleByTimeRangeListReq reqDto) {

        try {
            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();

            // TODO: 2024/5/13
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.ge("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetAttributionCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsTargetAttributionCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-07批量查询目标归属周期by被评对象目标周期标识（双排序）[9729]
   * gen by moon at 6/4/2024, 2:54:18 PM
   */
 @Trace(operationName = "3-3-09-07批量查询目标归属周期by被评对象目标周期标识（双排序）")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsTargetAttributionCycle>  batchQueryTargetAttributionCycleByEvaObjTargetCycleCode(BatchQueryTargetAttributionCycleByEvaObjTargetCycleCodeReq reqDto) {

        try {
            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();

            // TODO: 2024/5/13
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.le("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.ge("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }

            if(reqDto.getTargetBelongCycleList()==null || reqDto.getTargetBelongCycleList().isEmpty()){
                    return new ArrayList<>();
            }
        queryWrapper.in("eva_obj_target_cycle_code", reqDto.getTargetBelongCycleList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetAttributionCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            queryWrapper.orderByDesc("order_number");
queryWrapper.orderByDesc(CommonFunctionHelper.buildSpecOderBy("eva_obj_target_cycle_code"));
queryWrapper.orderByDesc("operate_time");
            return ((List<OmsTargetAttributionCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-07查询目标归属周期列表(开始时间小于结束时间大于等于)[9801]
   * gen by moon at 6/14/2024, 6:29:32 PM
   */
 @Trace(operationName = "3-3-09-07查询目标归属周期列表(开始时间小于结束时间大于等于)")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsTargetAttributionCycle>  queryTargetBelongCycleStartLessEqualEndBigList(QueryTargetBelongCycleStartLessEqualEndBigListReq reqDto) {

        try {
            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();

            // TODO: 2024/5/13
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.lt("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.ge("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetAttributionCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsTargetAttributionCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-07查询目标归属周期（大于等于开始时间&小于等于结束时间）详情[9578]
   * gen by moon at 6/21/2024, 12:59:12 PM
   */
 @Trace(operationName = "3-3-09-07查询目标归属周期（大于等于开始时间&小于等于结束时间）详情")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  OmsTargetAttributionCycle  queryTargetBelongCycleByGeStartAndLeEndTimeDetail(QueryTargetBelongCycleByGeStartAndLeEndTimeDetailReq reqDto) {

        try {

            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();

            // TODO: 2024/6/21
            if(reqDto.getCycleStartTime()!=null && reqDto.getCycleEndTime()!=null){
                queryWrapper.ge("cycle_start_time",reqDto.getCycleStartTime());
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleStartTime(null);
                reqDto.setCycleEndTime(null);
            }
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsTargetAttributionCycle> retList = super.list(queryWrapper);
            if(retList!=null && retList.size()>0){
                OmsTargetAttributionCycle retData = retList.get(0);

                return retData;
            }
            return null;
      } catch (Exception e) {
          e.printStackTrace();
          throw new BizException("-1",e,false);
      }
  }
/**
   * 3-3-09-07批量查询目标归属周期By内容ID[9857]
   * gen by moon at 6/23/2024, 7:14:18 AM
   */
 @Trace(operationName = "3-3-09-07批量查询目标归属周期By内容ID")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsTargetAttributionCycle>  batchQueryTargetBelongCycleCom(BatchQueryTargetBelongCycleComReq reqDto) {

        try {
            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();

            if(reqDto.getTargetBelongCycleList()==null || reqDto.getTargetBelongCycleList().isEmpty()){
                    return new ArrayList<>();
                }
        queryWrapper.in("belong_to_content_id", reqDto.getTargetBelongCycleList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetAttributionCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsTargetAttributionCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-07批量查询目标归属周期by末级目标分类[9906]
   * gen by moon at 6/30/2024, 9:59:27 PM
   */
 @Trace(operationName = "3-3-09-07批量查询目标归属周期by末级目标分类")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsTargetAttributionCycle>  batchQueryTargetBelongCycleByLastTargetCatId(BatchQueryTargetBelongCycleByLastTargetCatIdReq reqDto) {

        try {
            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();

            if(reqDto.getTargetBelongCycleList()==null || reqDto.getTargetBelongCycleList().isEmpty()){
                    return new ArrayList<>();
                }
        queryWrapper.in("correlation_last_target_cat_id", reqDto.getTargetBelongCycleList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetAttributionCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsTargetAttributionCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-07查询目标归属周期（大于等于时间或小于等结束时间）-双排序列表[9936]
   * gen by moon at 7/5/2024, 11:12:47 PM
   */
 @Trace(operationName = "3-3-09-07查询目标归属周期（大于等于时间或小于等结束时间）-双排序列表")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsTargetAttributionCycle>  queryTargetBelongCycleByGeStartOrLeEndTimeSortList(QueryTargetBelongCycleByGeStartOrLeEndTimeSortListReq reqDto) {

        try {
            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();


            // TODO: 2024/7/6
            if(reqDto.getCycleStartTime()!=null){
                queryWrapper.ge("cycle_start_time",reqDto.getCycleStartTime());
                reqDto.setCycleStartTime(null);
            }
            if(reqDto.getCycleEndTime()!=null){
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleEndTime(null);
            }

            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetAttributionCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            queryWrapper.orderByDesc("order_number");
queryWrapper.orderByDesc("eva_obj_target_cycle_code");
queryWrapper.orderByDesc("operate_time");
            return ((List<OmsTargetAttributionCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-07查询目标归属周期（小于等于开始时间或小于等于结束时间）列表[10001]
   * gen by moon at 7/20/2024, 10:54:41 PM
   */
 @Trace(operationName = "3-3-09-07查询目标归属周期（小于等于开始时间或小于等于结束时间）列表")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsTargetAttributionCycle>  queryTargetBelongCycleByLeStartOrGeEndTimeSorList(QueryTargetBelongCycleByLeStartOrGeEndTimeSorListReq reqDto) {

        try {
            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();


            // TODO: 2024/7/6
            if(reqDto.getCycleStartTime()!=null){
                queryWrapper.le("cycle_start_time",reqDto.getCycleStartTime());
                reqDto.setCycleStartTime(null);
            }
            if(reqDto.getCycleEndTime()!=null){
                queryWrapper.le("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleEndTime(null);
            }

            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetAttributionCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);
            queryWrapper.orderByDesc("order_number");
queryWrapper.orderByDesc("operate_time");
            return ((List<OmsTargetAttributionCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-07批量查询目标归属周期By周期ID[10108]
   * gen by moon at 8/19/2024, 9:23:19 PM
   */
 @Trace(operationName = "3-3-09-07批量查询目标归属周期By周期ID")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsTargetAttributionCycle>  batchQueryTargetBelongCycleByCycleId(BatchQueryTargetBelongCycleByCycleIdReq reqDto) {

        try {
            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();

            if(reqDto.getTargetBelongCycleList()==null || reqDto.getTargetBelongCycleList().isEmpty()){
                    return new ArrayList<>();
                }
        queryWrapper.in("cycle_id", reqDto.getTargetBelongCycleList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetAttributionCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsTargetAttributionCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-07批量查询目标归属周期By归属内容[10216]
   * gen by moon at 9/12/2024, 3:08:37 PM
   */
 @Trace(operationName = "3-3-09-07批量查询目标归属周期By归属内容")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsTargetAttributionCycle>  batchQueryTargetBelongCycleByEntityId(BatchQueryTargetBelongCycleByEntityIdReq reqDto) {

        try {
            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();

            if(reqDto.getTargetBelongCycleList()==null || reqDto.getTargetBelongCycleList().isEmpty()){
                    return new ArrayList<>();
                }
        queryWrapper.in("entity_id", reqDto.getTargetBelongCycleList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetAttributionCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsTargetAttributionCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-07查询目标归属周期详情[10228]
   * gen by moon at 9/15/2024, 7:07:15 PM
   */
 @Trace(operationName = "3-3-09-07查询目标归属周期详情")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  OmsTargetAttributionCycle  queryTargetAttributionCycleDetail(QueryTargetAttributionCycleDetailReq reqDto) {

        try {

            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsTargetAttributionCycle> retList = super.list(queryWrapper);
            if(retList!=null && retList.size()>0){
                OmsTargetAttributionCycle retData = retList.get(0);

                return retData;
            }
            return null;
      } catch (Exception e) {
          e.printStackTrace();
          throw new BizException("-1",e,false);
        }
  }
/**
   * 3-3-09-07查询目标归属周期列表by开始时间大于等于&结束时间小于[10241]
   * gen by moon at 9/25/2024, 6:17:43 PM
   */
 @Trace(operationName = "3-3-09-07查询目标归属周期列表by开始时间大于等于&结束时间小于")
 @Tags({@Tag(key = "参数",value = "arg[0]"),
 @Tag(key = "返回值",value = "returnedObj")})
  @Override
  @Transactional(rollbackFor=Exception.class)
  public  List<OmsTargetAttributionCycle>  queryTargetBelongCycleByGeStartAndLtEndTimeList(QueryTargetBelongCycleByGeStartAndLtEndTimeListReq reqDto) {

        try {
            QueryWrapper<OmsTargetAttributionCycle> queryWrapper = new QueryWrapper<>();


            // TODO: 2024/7/6
            if(reqDto.getCycleStartTime()!=null){
                queryWrapper.ge("cycle_start_time",reqDto.getCycleStartTime());
                reqDto.setCycleStartTime(null);
            }
            if(reqDto.getCycleEndTime()!=null){
                queryWrapper.lt("cycle_end_time",reqDto.getCycleEndTime());
                reqDto.setCycleEndTime(null);
            }

            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsTargetAttributionCycle.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper,likeList,fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap,likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsTargetAttributionCycle.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsTargetAttributionCycle>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1",e,false);
        }
  }
}
